import { request } from '../request';

export function fetchSearch(param: Api.GroupEntity.GroupSearchParams) {
  return request<Api.Common.PaginatingQueryRecord<Api.GroupEntity.GroupModel>>({
    url: '/api/Group/Search',
    method: 'post',
    data: param
  });
}

export function fetchGetInfo(id: number) {
  return request<Api.GroupEntity.GroupModel>({
    url: '/api/Group/GetInfo',
    method: 'get',
    params: { id }
  });
}

export function fetchSave(param: Api.GroupEntity.GroupModel) {
  return request<Api.Common.BaseR<Api.GroupEntity.GroupModel>>({
    url: '/api/Group/Save',
    method: 'post',
    data: param
  });
}

export function fetchDelete(id: number) {
  return request<Api.Common.BaseR>({
    url: `/api/Group/Delete?id=${id}`,
    method: 'post'
  });
}

export function fetchSearchInStaff(param: Api.GroupEntity.GroupStaffSearchParams) {
  return request<Api.Common.PaginatingQueryRecord<Api.GroupEntity.GroupStaffModel>>({
    url: '/api/Group/SearchInStaff',
    method: 'post',
    data: param
  });
}

export function fetchStaffDelete(id: number) {
  return request<Api.Common.BaseR>({
    url: `/api/Group/StaffDelete?id=${id}`,
    method: 'post'
  });
}

export function fetchStaffClear(id: number) {
  return request<Api.Common.BaseR>({
    url: `/api/Group/Clear?id=${id}`,
    method: 'post'
  });
}

export function fetchStaffSave(param: Api.GroupEntity.GroupStaffModel) {
  return request<Api.Common.BaseR<Api.GroupEntity.GroupStaffModel>>({
    url: '/api/Group/StaffSave',
    method: 'post',
    data: param
  });
}
